<template>
  <view class="pk-popup">
    <view class="pk-popup-mask" @click="onMask"></view>
    <view class="pk-popup-content">
      <slot></slot> 
      <view class="pk-popup-footer">
        <pk-btn size="small" @click="onClose" type="danger">关闭</pk-btn>
      </view>
    </view> 
  </view>
</template>

<script setup>
import { ref, defineEmits } from 'vue'

const emtis = defineEmits(['onMask', 'onClose'])

 const onMask = () => {
   emtis('onClose')
 }

 const onClose = () => {
   emtis('onClose')
 }
</script>

<style lang="scss" scoped>
.pk-popup{
  position: fixed;
  top:0;
  bottom: 0;
  left:0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  &-mask{
    position: fixed;
    top:0;
    bottom: 0;
    left:0;
    right: 0;
    background: rgba(0,0,0,.3);
  }
  &-content{
    background: #fff; 
    z-index: 1000;
    border-radius: 24rpx;
    min-height: 24rpx;
  }
  &-footer{
    margin: 24rpx auto;
    display: flex;
    flex-direction: row;
    justify-content: center;
    align-items: center;
  }
}
</style>